import { required, passwordLimit } from "../validators";
export const searchRule = () => {
  return [
    {
      type: "input",
      field: "name",
      title: "站点名称",
      value: "",
      col: {
        span: 6
      }
    },
    {
      type: "input",
      field: "IP",
      title: "IP",
      value: "",
      col: {
        span: 6
      }
    }
  ];
};

export const editRule = () => {
  return [
    {
      type: "input",
      field: "userName",
      title: "账号",
      props: {
        disabled: true
      },
      tableVisible: true
    },
    {
      type: "input",
      field: "oldPwd",
      title: "旧密码",
      tableVisible: true,
      props: { placeholder: "请输入旧密码" },
      validate: [required()],
      props: {
        type: "password",
        autocomplete: "off"
      }
    },
    {
      type: "input",
      field: "newPwd",
      title: "新密码",
      props: { placeholder: "请输入新密码" },
      validate: [passwordLimit()],
      props: {
        type: "password",
        autocomplete: "off"
      },
      tableVisible: true
    },
    {
      type: "input",
      field: "surepassword",
      title: "确认密码",
      props: { placeholder: "请输入新确认密码" },
      validate: [required()],
      props: {
        type: "password",
        autocomplete: "off"
      },
      tableVisible: true
    }
  ];
};

export const newPassword = () => {
  return [
    {
      type: "input",
      field: "password",
      title: "新密码",
      props: { placeholder: "请输入新密码" },
      validate: [passwordLimit()],
      props: {
        type: "password",
        autocomplete: "off"
      },
      tableVisible: true
    }
  ];
};
